Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37737 - expiration registration url param #10278

Closed
wants to merge 1 commit into from

Conversation

lzap
Copy link
Member

@lzap lzap commented Aug 16, 2024

Registration command does not show the expiration in any form, I would like to add this information into unused URL parameter as UNIX UTC epoch so consumers can tell if an existing registration command is expected to work on not.

We would like to bake this information into images created by image builder so users can tell if images are already expired and need to be rebuilt.

JWT spec specifies expiration it is relative tho which is not too useful for our use case. From what I saw, Foreman does not add any JWT expiration into the JSON.

I do not have development setup anymore, trying out blindly to see which tests will scream for an update.

@ezr-ondrej
Copy link
Member

What do you think about adding it as claim exp in epoch format? Wouldn't that be more straight forward?

@ezr-ondrej
Copy link
Member

It seems to be encoded to the token already:

payload[:exp] = (Time.now.to_i + expiration) if expiration
would that be usable? :)

@lzap
Copy link
Member Author

lzap commented Aug 16, 2024

I just realized the token does contain expiration:

eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1LCJpYXQiOjE3MjM4Mzc3MjIsImp0aSI6IjBhNTU3MDM3ZDIyNzUyMDYwM2M3MWIzZDI4NGYwZjQ1NmFjYjE5NzEyNmFmNTk5NzU0NWJmODcwZDczM2RhY2YiLCJleHAiOjE3MjM4NTIxMjIsInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.HsSnZEqq--MIJfP3_awn6SflEruoEm77iSWh0Pi6EW4

There is some extra data appended to it tho. Can someone explain? Is this according to JWT spec?

{"alg":"HS256"}{"user_id":5,"iat":1723837722,"jti":"0a557037d227520603c71b3d284f0f456acb197126af5997545bf870d733dacf","exp":1723852122,"scope":"registration#global registration#host"}ħdJª0�_?v°�¤��Jî I»î$��CâèE¸

Anyway, this can be used for expiration. No need for a new param.

@lzap lzap closed this Aug 16, 2024
@lzap lzap deleted the expires-token-at branch August 16, 2024 19:51
@lzap
Copy link
Member Author

lzap commented Aug 19, 2024

Asked on Slack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants